package gold.digger;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC168 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public String convertToTitle(int n) {
            StringBuilder res = new StringBuilder();
            while (n >= 1) {
                res.append(String.valueOf((char) ((n - 1) % 26 + 'A')));
                n = (n - 1) / 26;
            }

            return res.reverse().toString();
        }
    }

    public void run() {
        Solution solution = new Solution();
        System.out.println(solution.convertToTitle(28));
    }

    public static void main(String[] args) throws Exception {
        LC168 an = new LC168();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
